---
# Setup a fedmsg-hub

- name: install needed packages
  yum: pkg={{ item }} state=installed
  with_items:
  - fedmsg-hub
  tags:
  - packages

- name: ensure that nrpe has rights to monitor us
  file: >
    dest=/var/run/fedmsg/monitoring-fedmsg-hub.socket
    mode=0775
    owner=fedmsg
    group=nrpe
    state=file
  ignore_errors: true

- name: fedmsg-hub service
  service: name=fedmsg-hub state=started enabled=yes

- name: enable the websocket server if we should
  copy: src=websockets.py dest=/etc/fedmsg.d/websockets.py
  when: enable_websocket_server
  notify: restart fedmsg-hub

- name: disable the websocket server if we should..
  file: dest=/etc/fedmsg.d/websockets.py state=absent
  when: not enable_websocket_server
  notify: restart fedmsg-hub

